<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>高阶函数</title>
</head>
<body>
高阶函数
<script>
  console.log("=============filter begin=============")
  var filterMate=[-1,-2,0,1,2,3]
  console.log(filterMate.filter(item=>{return item>0}))
  console.log("=============filter end=============")

  console.log("=============map begin=============")
  var mapMate=[-1,-2,0,1,2,3]
  console.log(mapMate.map(item=>{return Math.abs(item)}))
  console.log("=============map end=============")

  console.log("=============reduce begin=============")
  var reduceMate=[0,1,2,3]
  console.log(reduceMate.reduce((x,y)=>{return x+y}))
  console.log("=============reduce end=============")

</script>
</body>
</html>
